package com.example.chessbattleplatform.web.room_board.controller;

import com.example.chessbattleplatform.Pojo.Result.WebResult;
import com.example.chessbattleplatform.web.room_board.Pojo.dto.PiecesDto;
import com.example.chessbattleplatform.web.room_board.Service.impl.RoomBoardServiceInterface;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/gaming")
@RequiredArgsConstructor
public class GamingController {
    // 导入业务层
    private final RoomBoardServiceInterface roomBoardService;

    //创建游戏 （初始化游戏 初始化）
    @PostMapping("/")
    public WebResult<?> initRoomBoard(@Validated @RequestBody PiecesDto piecesDto) {
        // 返回 初始 棋盘数据
        return WebResult.success(roomBoardService.initRoomBoard(piecesDto));
    }


}
